all: parser.y lexer.l
	bison -d -v parser.y
	lex lexer.l
	gcc -std=c99 latex_math.c lex.yy.c parser.tab.c -o calc -lfl -lm -D_POSIX_SOURCE

clean:
	rm calc
	rm parser.tab.c
	rm parser.tab.h
	rm lex.yy.c
	rm parser.output

rebuild: clean all

test: all
	./calc < test/test.in > test/test.tmp
	diff test/test.tmp test/test.out

	./calc < test/testFrac.in > test/test.tmp
	diff test/test.tmp test/testFrac.out
